
#include "mainwidget.h"


mainWidget::mainWidget(QWidget *parent)
    : QWidget(parent)
{
    layout = new QGridLayout(this);
    lblGameWindow = new GameWindowLabel(this);



    btnStart = new QPushButton("开 始",this);
    btnStart->setFixedHeight(40);

    btnPause = new QPushButton("暂 停",this);
    btnPause->setFixedHeight(40);

    layout->addWidget(lblGameWindow, 0, 0, 1, 2);
    layout->addWidget(btnStart,1,0,1,1);
    layout->addWidget(btnPause,1,1);



    layout->setContentsMargins(0,0,0,0);
    layout->setSpacing(0);

    setFixedSize(800,800);
    setWindowTitle("typegaming");

    connect(btnStart,&QPushButton::clicked,this,[=](){
        qDebug()<<"btnStart clicked";
        lblGameWindow->generateWords(10);
    });
}
void mainWidget::keyPressEvent(QKeyEvent *ev){
    //qDebug() << ev->text();
    lblGameWindow->getKey(ev->text());
}


mainWidget::~mainWidget()
{
}


